// src/utils/echarts-config.js
import * as echarts from 'echarts/core'
// 1. ECharts 基础组件（所有图表共用）
import {
  DatasetComponent,
  TitleComponent,
  TooltipComponent,
  GridComponent,
  TransformComponent,
  LegendComponent,
  DataZoomComponent
} from 'echarts/components'
// 2. 2D 图表（回归分析、折线图等共用）
import { ScatterChart, LineChart, BarChart, PieChart } from 'echarts/charts'
// 3. ECharts 功能特性
import { UniversalTransition, LabelLayout } from 'echarts/features'
// 4. 渲染器
import { CanvasRenderer } from 'echarts/renderers'
// 5. echarts-gl 3D 组件（支持 3DWorld，仅注册必要组件）
import { GlobeComponent, Geo3DComponent } from 'echarts-gl/components'
import { Lines3DChart, Scatter3DChart } from 'echarts-gl/charts'

// 统一注册所有组件（仅注册一次，避免重复）
echarts.use([
  // 基础组件
  DatasetComponent,
  TitleComponent,
  TooltipComponent,
  GridComponent,
  TransformComponent,
  LegendComponent,
  DataZoomComponent,
  // 2D 图表
  ScatterChart,
  LineChart,
  BarChart,
  PieChart,
  // 功能特性
  UniversalTransition,
  LabelLayout,
  // 渲染器
  CanvasRenderer,
  // 3D 组件（支持 3DWorld）
  GlobeComponent,
  Geo3DComponent,
  Lines3DChart,
  Scatter3DChart
])

export default echarts